package com.hrh.selectsystem.mapper;

import com.hrh.selectsystem.model.dto.mentor.MentorQueryRequest;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hrh.selectsystem.model.entity.ChoiceRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author hetongxue
* @description 针对表【choice_record(选择记录)】的数据库操作Mapper
* @createDate 2024-10-26 14:03:03
* @Entity com.hrh.selectsystem.model.entity.choicerecord
*/
@Mapper
public interface ChoiceRecordMapper extends BaseMapper<ChoiceRecord> {

    @Select("SELECT cr.id, cr.studentId, cr.firstChoice, cr.secondChoice, cr.thirdChoice, cr.firstStatus, cr.secondStatus, cr.thirdStatus " +
            "FROM choice_record cr " +
            "WHERE cr.studentId = #{studentId}")
    ChoiceRecord getChoiceRecordByStudentId(@Param("studentId") Long studentId);

    @Select("<script>" +
            "SELECT m.id, m.mentoraccount, m.mentorName, m.mentorCollege, m.userAvatar, m.gender " +
            "FROM mentor m " +
            "WHERE m.id IN " +
            "<foreach item='mentorId' collection='mentorIds' open='(' separator=',' close=')'>" +
            "#{mentorId}" +
            "</foreach>" +
            "</script>")
    List<MentorQueryRequest> getMentorsByIds(@Param("mentorIds") List<Long> mentorIds);
}




